<template>
	<view class="user clearfix hv100">
		<image src="/static/wallet/licai.png" class="licaibg" mode=""></image>
		<cu-custom bgColor="bg-transparent text-white" isBack>
			<block slot="content">理财</block>
		</cu-custom>
		<view class="whitebox bg-white flex flex-direction align-center px15">
			<text class="f12 text-info mt30">总余额</text>
			<view class="mt15 f26">{{balance}}</view>
			<view class="mt10 flex align-center">
				<text>日化率：</text>
				<text class="text-red">{{rihua}}%</text>
			</view>
			<view class="payline mt20"></view>
			<view class="mt20 wp100 text-left f16">转到金种子</view>
			<view class="mt15 moneybox flex align-center justify-between px15">
				<view class="flex align-center">
					<text class="f22">￥</text>
					<input type="number" v-model="money" class="f14 ml10" :placeholder="'本次最多可转出'+balance+'元'" placeholder-class="text-info" />
				</view>
				<text @click="money=balance">全部</text>
			</view>
			<view class="mt15 moneybox flex align-center justify-between px15">
				<view class="flex align-center">
					<input password maxlength="6" v-model="paypwd" class="f14 ml10" placeholder="请输入支付密码" placeholder-class="text-info" />
				</view>
			</view>
		</view>
		<view class="mt20 text-red px15 f12">注：</view>
		<view class="mt5 px15 f12">1、利息按天计算，随进随出</view>
		<view class="mt5 px15 f12">2、当天转入24小时后的凌晨才有分红结算</view>
		<view class="red-button discenter" @click="pay">确认转入</view>
	</view>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
	data() {
		return {
			money:'',
			balance:'0.00',
			rihua:'0',
			paypwd:'',
		}
	},
	onLoad() {
		this.getData()
	},
	methods: {
		async getData() {
			let {
				data: { yueNum, rhlBl }
			} = await this.$http.post('wallet.yuelicaipage', {}, { tipConfig: { storeBlock: true } })
			this.balance = yueNum
			this.rihua = rhlBl
		},
		async pay(){
			if(this.money==''||this.money==0){
				uni.showToast({
					title:'轻输入正确的充值金额',
					icon:'none'
				})
				return false
			}
			if(this.paypwd==''){
				uni.showToast({
					title:'轻输入支付密码',
					icon:'none'
				})
				return false
			}
			let { data } = 	await this.$http.post('wallet.yuelicaipay', {yueNum:this.money,payPassword:this.paypwd}, {
				custom: {tipConfig: { storeLoading: true, isSuccessTip: true, isSuccessBack: true, navigateBack: 1 }}
			})
		}
	}
}
</script>

<style lang="less">
.moneybox{
	width: 100%;
	height: 90rpx;
	border-radius: 60rpx;
	background-color: #F7F7F7;
}
.payline{
	width: 100%;
	height: 2rpx;
	background-color: #F2F2F2;
}
.licaibg{
	width: 100%;
	height: 370rpx;
	position: fixed;
	top: 0;
}
.whitebox{
	width: calc(100% - 60rpx);
	margin-left: 30rpx;
	height: 630rpx;
	border-radius: 10rpx;
	position: relative;
	margin-top: 30rpx;
}
.red-button{
	width: calc(100% - 60rpx);
	margin-left: 30rpx;
	height: 90rpx;
	border-radius: 10rpx;
	background-color: #D73329;
	color: #FFFFFF;
	margin-top:80rpx ;
}
</style>
